/*----------------------------------------------------------------------------*\
| /gamemode/wswitch.lua                | weapon-switching system         | SRV |
\*----------------------------------------------------------------------------*/

function cmdSelectWeapon(ply,cmd,args)
	ply:SelectWeapon(args[1])
	return true
end
concommand.Add("selectweapon",cmdSelectWeapon)

function GM:PlayerCanPickupWeapon(ply,wep)
	local weapclass = wep:GetClass()
	
	local function setweapons(index,state)
	umsg.Start("SetWeapon", ply)
		umsg.Short(index)
		umsg.Bool(state)
	umsg.End() 
	end
	
	if (weapclass=="weapon_fists") then setweapons(0,true) end
	if (weapclass=="weapon_huntingknife") then setweapons(1,true) end
	if (weapclass=="weapon_flashlight") then setweapons(2,true) end
	if (weapclass=="weapon_chainsaw") then setweapons(3,true) end
	if (weapclass=="weapon_9mmpistol") then setweapons(4,true) end
	if (weapclass=="weapon_revolver") then setweapons(5,true) end
	if (weapclass=="weapon_assaultrifle") then setweapons(8,true) end
	if (weapclass=="weapon_submachinegun") then setweapons(9,true) end
	if (weapclass=="weapon_combatshotgun") then setweapons(12,true) end
	if (weapclass=="weapon_huntingshotgun") then setweapons(13,true) end
	if (weapclass=="weapon_rifle") then setweapons(14,true) end
	return true
end
